 
<template>
  <div class="border">
    <div>我是组件B</div>
    <div>计算和: {{count}}</div>
    <Button @click="removeHandler" type="primary">移除监听</Button>
  </div>
</template>
 
<script>
import { EventBus } from "./event-bus.js";
export default {
  data() {
    return {
      count: 0
    };
  },
  methods: {
    removeHandler() {
      EventBus.$off("addition");
      // EventBus.$off();
    }
  },
  mounted() {
    EventBus.$on("addition", param => {
      this.count = this.count + param.num;
    });
  }
};
</script>
<style scoped>
.border {
  border: 1px solid blueviolet;
  border-radius: 5px;
  padding: 24px;
}
</style>